import java.util.Objects;
class A{
    public int id;
    public A(int id){
        this.id=id;
    }
    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
    @Override
    public boolean equals(Object obj){
        if(obj==null){
            return false;
        }
        if(this==obj){
            return true;
        }
        if(!(obj instanceof A)){
            return false;
        }
        A tmp = (A)obj;
        return this.id == tmp.id;

    }
}
public class TestDemo3 {
    public static void main(String[] args) {
        A a1 = new A(1);
        A a2 = new A(1);
        System.out.println(a1.hashCode());
        System.out.println(a2.hashCode());
        System.out.println(a1.equals(a2));
    }
}
